Ext.define('Admin.view.employment.EmploymentGridPanel', {
    extend: 'Ext.grid.Panel',
    xtype: 'employmentGridPanel',
    id:'employmentGridPanel',
    	
    requires: [
    	//'Ext.grid.column.RowNumberer',
    	'Ext.selection.CheckboxModel'
    ],
    title: '合同列表',
    //store: Ext.data.StoreManager.lookup('simpsonsStore'),
	bind: '{employmentDataList}',
 	selModel: {
		selType: 'checkboxmodel',
        checkOnly: true,
        showHeaderCheckbox: true
    },
    //multiSelect: true,
     dockedItems: [{
        xtype: 'toolbar',
        items: [{
	        xtype: 'combobox',
	        fieldLabel: '',
	        name: 'searchFieldName',
	        reference:'searchFieldName',
	        store: {
	            proxy: {
	                type: 'memory',
	                reader: 'array'
	            },
	            fields: [ 'key', 'value'],
	            data: [
	            	['员工ID', 'empId'],
	                ['合同备注', 'remark']
	            ]
	        },
	        queryMode: 'local',
	        displayField: 'key',
	        valueField: 'value',
	       	value:'empId',
	        allowBlank: false
	    },'-',{
            xtype: 'textfield',
            name:'searchFieldValue',
            reference:'searchFieldValue'
        },'-',{
            text:'快捷查询',
            tooltip:'快捷查询',
            iconCls:'x-fa fa-search',
            handler : 'search'
        },
	        /*'-',{
            text:'高级查询',
            tooltip:'高级查询',
            iconCls:'x-fa fa-search-plus',
            handler : 'openMoreSearchWindow'
        },*/
        '-',{
            text:'新增合同',
            tooltip:'新增合同',
            iconCls:'x-fa fa-plus',
            handler : 'openAddWindow'
        }]
    }],
    columns: [
    		//{xtype: 'rownumberer',width: 40, sortable: false},
    		{
            xtype: 'actioncolumn',
            items: [
            //{xtype: 'button',
                //iconText:'增加',
                //iconCls: 'x-fa fa-plus',
               // handler : 'openAddWindow'
            //},
            {
        		xtype: 'button',
                iconCls: 'x-fa fa-pencil',
                handler : 'openEditWindow'
            },{
                xtype: 'button',
                iconCls: 'x-fa fa-trash',
                handler : 'deleteEmployment'
            }],
            cls: 'content-column',
            width: 120,
            //dataIndex: 'bool',
            text: '操作',
            tooltip: '操作 '
          },
         
		 { header: 'ID',  dataIndex: 'id',hiden:true ,flex: 1},
		 { header: 'EmpId',  dataIndex: 'empId',width: 100},
         { header: 'TimtLimit',  dataIndex: 'timeLimit' ,width: 100},
         { header: 'Remark', dataIndex: 'remark',sortable: false,width: 100},
         { header: 'BreakReason', dataIndex: 'breakReason' ,sortable: false,width: 120},
		 { header: 'UnderWriteDate', dataIndex: 'underWriteDate' ,sortable: true ,width: 160 ,renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s')},
		{ header: 'BreakDate', dataIndex: 'breakDate' ,sortable: true ,width: 160 ,renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s')},
		{ header: 'OverDate', dataIndex: 'overDate' ,sortable: true ,width: 160 ,renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s')}
    ],
    columnLines: true,
	bbar: {
	    xtype: 'pagingtoolbar',//注意以后MVVM中使用新写法,不要使用Ext.create()
        //store: Ext.data.StoreManager.lookup('simpsonsStore'),
        bind: '{employmentDataList}',
        displayInfo: true,
        displayMsg: 'Displaying topics {0} - {1} of {2}',
        emptyMsg: "No topics to display",
        items:[
            '-', {
            text: '批量删除',
            listeners: {
			    click:'deleteEmployments'
			}
        }]
    }
});